<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
</script>
</head>
<body>
 <form action="${pageContext.request.contextPath }/test/test.action" method="post">
    文献标题:<input  name="title" type="text">
		<br>
	关键字():<input name="keywords" type="text">
		<br>
	摘&nbsp;&nbsp;要:<textarea name="summary" ></textarea>
		<br>
	发表时间:<input name="publishedTime" type="text">
		<br>
	支持基金:<input name="fund" type="text">
		<br>
	
		<div id="queryinput">
				作&nbsp;&nbsp;者：<input class="a" type="text"  >作者单位:<input class="b"  type='text' name="anut"><br>
		</div>
		
		<input  type="hidden"  name="author"  id="a">
		<input  type="hidden"  name="AU" id="b">
		
		
		<input type="button" name="add" value="添加作者栏位" />
		<input type="button" name="bt" value="show" />
		<!-- 提交表单 -->
		
	    <input type="submit" value="Submit" id="sub">
	    
    </form>
    
    <script type="text/javascript">
	  $(document).ready(function(){
		     var a="",b="";
		     
			        $("#sub").click(function(event) {
			        	alert("哈哈哈") 
			        }); 
		     
	        $("input[name='add']").click(function(event) {
	            $("#queryinput").append("作&nbsp;&nbsp;者：<input class='a' id='au' type='text'  name=''>作者单位:<input class='b'  type='text' name='autu'><br>");
	        });
	        
	        $("input[name='bt']").click(function(){
	        	// 获取所有作者名字集合
	        	 $("input").filter(".a").each(function(){
	        		a=a+$(this).val()+"#"
	    			alert(a)
	    		});
	            $("#a").val(a);
	        	
	        	
	        	 
	        	//获取所有作者单位集合
	        	 $("input").filter(".b").each(function(){
		        		b=b+$(this).val()+"#"
		    			alert(b)
		    		});
	        	 $("#b").val("b");
	    	});
	      
	        
	        
	    })
	</script>
	
</body>
</html>